/*   1:    */ package com.atomikos.icatch.imp.thread;
/*   2:    */ 
/*   3:    */ import com.atomikos.util.ClassLoadingHelper;
/*   4:    */ import java.lang.reflect.Array;
/*   5:    */ import java.lang.reflect.Constructor;
/*   6:    */ import java.lang.reflect.Method;
/*   7:    */ import java.lang.reflect.Proxy;
/*   8:    */ 
/*   9:    */ public class Java14BackportExecutorFactory
/*  10:    */   extends Java15ExecutorFactory
/*  11:    */ {
/*  12:    */   public static final String MAIN_CLASS = "edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor";
/*  13:    */   public static final String IQUEUE_CLASS = "edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue";
/*  14:    */   public static final String QUEUE_CLASS = "edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue";
/*  15:    */   public static final String TIMEUNIT_CLASS = "edu.emory.mathcs.backport.java.util.concurrent.TimeUnit";
/*  16:    */   public static final String IFACTORY_CLASS = "edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory";
/*  17:    */   
/*  18:    */   protected Java14BackportExecutorFactory()
/*  19:    */     throws Exception
/*  20:    */   {}
/*  21:    */   
/*  22:    */   protected Constructor extractConstructor(Class poolClass)
/*  23:    */     throws Exception
/*  24:    */   {
/*  25: 58 */     return poolClass.getConstructor(new Class[] { Integer.TYPE, Integer.TYPE, Long.TYPE, loadClass("edu.emory.mathcs.backport.java.util.concurrent.TimeUnit"), loadClass("edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue"), loadClass("edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory") });
/*  26:    */   }
/*  27:    */   
/*  28:    */   protected Object[] toConstructionParameters()
/*  29:    */     throws Exception
/*  30:    */   {
/*  31: 70 */     ClassLoader loader = getClass().getClassLoader();
/*  32: 71 */     Object factory = Proxy.newProxyInstance(loader, new Class[] { loadClass("edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory") }, new Java15ExecutorFactory.FactoryProxy());
/*  33: 72 */     Object queue = loadClass("edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue").newInstance();
/*  34: 73 */     return new Object[] { new Integer(0), new Integer(2147483647), new Long(60L), getSecondTimeUnit(), queue, factory };
/*  35:    */   }
/*  36:    */   
/*  37:    */   protected Class loadMainPoolClass()
/*  38:    */     throws Exception
/*  39:    */   {
/*  40: 85 */     return loadClass("edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor");
/*  41:    */   }
/*  42:    */   
/*  43:    */   private static Object getSecondTimeUnit()
/*  44:    */     throws Exception
/*  45:    */   {
/*  46: 93 */     Class cl = ClassLoadingHelper.loadClass("edu.emory.mathcs.backport.java.util.concurrent.TimeUnit");
/*  47: 94 */     Method m = cl.getMethod("values", null);
/*  48: 95 */     Object o = m.invoke(cl, null);
/*  49: 96 */     int len = Array.getLength(o);
/*  50: 97 */     for (int i = 0; i < len; i++)
/*  51:    */     {
/*  52: 98 */       Object test = Array.get(o, i);
/*  53: 99 */       if (test.toString().equals("SECONDS")) {
/*  54:100 */         return test;
/*  55:    */       }
/*  56:    */     }
/*  57:103 */     return null;
/*  58:    */   }
/*  59:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.thread.Java14BackportExecutorFactory
 * JD-Core Version:    0.7.0.1
 */